package top.amot.forceview.util;

import android.content.Context;

public class UiUtil {
    public static int sp2px(Context context,double sp) {
        float scale = context.getResources().getDisplayMetrics().scaledDensity;
        return (int) (sp * scale + 0.5f);
    }

    public static int dp2px(Context context,double dp) {
        float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }
}
